	function NiceShot() {
		this.objComm = null;
		this.objNiceShot = null;
	};
	
	NiceShot.prototype = {
			onPageShow: function() {
				this._init();
			}
			, _init: function(){
				
				$("a").attr("href","");
				
				this.objComm = new NiceShot_Comm();
	      this.objNiceShot = new clsNiceShot();
	      
	      this.objComm.setNiceShotRequest("게시판키", _util.nvl(_gf.COURSE_DATA["게시판키"]));
	      this.objComm.setNiceShotRequest("댓글키", _util.nvl(_gf.COURSE_DATA["댓글키"]));
	      this.objComm.setNiceShotRequest("서비스아이디", _util.nvl(_gf.COURSE_DATA["서비스아이디"]));
	      this.objComm.setNiceShotRequest("서비스명", _util.nvl(_gf.COURSE_DATA["서비스명"]));
	      	       
	      //프로필정보 조회
	      this.spinStart();
	      this.objComm.getNiceShotTarget();
	      
	      this._bind();
		      
			}
			, _bind: function(){
				var thisClass = this;
				
				//코스목록 조회 완료이벤트
				$(this.objComm).bind("evtFinishNiceShot", function(event){
					var thisData = thisClass.objComm.getNiceShotTargetData();
					thisClass.objNiceShot.setList(thisData);
					thisClass.spinEnd();
				});
				
				//프로필 이동 페이지
				this.objNiceShot.$getLayer().on("click", "li", function(event){
					var idx = thisClass.objNiceShot.$getLayer().find("li").index($(this));
					_gf.PROFILE_DATA["userId"] = thisClass.objNiceShot.listData[idx]["등록자"];
					$.mobile.changePage("../mypage/profile_view.html", "slide", true);
				});
			}
			, spinStart: function(){
				$.mobile.showPageLoadingMsg();
			}
			, spinEnd: function(){
				$.mobile.hidePageLoadingMsg();
			}
			
	}
	
	//데이터연동		
	function NiceShot_Comm(){
		this.niceshotTargetList = null;		
		this.niceshotRequest = null;
		
		this._init();		
	}
	NiceShot_Comm.prototype = {
		_init: function(){
			this.niceshotRequest = {
				"아이디": "dlendus"	
				, "페이지": null
				, "게시판키" : null
				, "댓글키": null
				, "서비스아이디": null
				, "서비스명": null
			}
		}
		, getNiceShotTarget: function(){
			var thisClass = this;
			
			var sid = "KB001";
			var serviceName = "getKnowhowBoardNiceshot";
			
			if(this.niceshotRequest["서비스아이디"]) sid = this.niceshotRequest["서비스아이디"];
			if(this.niceshotRequest["서비스명"]) serviceName = this.niceshotRequest["서비스명"];
			
			var objJson = new MJson();
			var cm = new ConnectionManager();

			objJson.putPub(MJson.PUB.SID, sid);
			objJson.putPub(MJson.PUB.SERVICENAME, serviceName);
			objJson.putPub(MJson.PUB.LISTCOUNT, 9999);
			objJson.putPub(MJson.PUB.CURRPAGENO, 1);
			
			objJson.putParameter("board_seq", this.niceshotRequest["게시판키"]);
			objJson.putParameter("reply_seq", this.niceshotRequest["댓글키"]);
			//_util.ajaxLog(objJson.getJsonString());
			cm.requestGet(objJson.getJsonString(), function($jsonData){
				
				var res = $jsonData["msp"]["contents"]["items"];
				thisClass.niceshotTargetList = [];
				if(res){
					if(!res.length){
						res = new Array(res);	
					}
					
					for(var i=0;i<res.length;++i){
						var obj = res;
							thisClass.niceshotTargetList.push({
								"게시판키": obj[i].board__seq
								, "댓글키": obj[i].reply__seq
								, "등록자": obj[i].reg__id
								, "닉네임": obj[i].reg__nickname
								, "이미지": obj[i].user__image
							});
					}
				}
				$(thisClass).trigger("evtFinishNiceShot");
			}, function($err) {
				alert($err);
			});
		}
		, getNiceShotTargetData: function(){
			return this.niceshotTargetList;
		}
		, setNiceShotRequest: function(key,val){
			this.niceshotRequest[key]=val;
		}
		, getNiceShotRequest: function(key){
			return this.niceshotRequest[key];
		}
	}
	
	function clsNiceShot(){
		this.listData = null;
		this._HTMLDom = null;
		this._init();
	}
	
	clsNiceShot.prototype = {
		_init: function(){
			var $layer = $("section#nice_shot>section");
			this._HTMLDom = {
				"$layer": $layer
				, "$element": $layer.find(">ul>li:first")
			}

			$layer.find(">ul").empty();
		}
		, setList: function(thisData){
			if(!this.listData) {			
				this.listData = [];	
			}
			this.listData = thisData;	
			this.display(thisData);
		}
		, display: function(thisData){
			var $layer = this._HTMLDom["$layer"];
			var $element = this._HTMLDom["$element"];
			var thisClass = this;
			
			for(var i=0;i<this.listData.length;++i){
				$layer.find(">ul").append($element.clone(true));
			}
			
			$layer.find(">ul li").each(function(n){
				$(this).find("img").attr("src", _util.nvl(thisClass.listData[n]["이미지"]).replace('/data/msp300/dl/files/free', 'http://192.168.0.82'));
				$(this).find("h3").html(thisClass.listData[n]["닉네임"]);
			});
			
		}
		, $getLayer: function(){
				return this._HTMLDom["$layer"].find(">ul");
		}
		, $getTabLayer: function(){
				return $("section#nice_shot>footer");
		}
	}
	
//	$(document).bind("pageinit", function(event){
//		//alert("pageinit");
//		
//		var path = String(document.location);
//		if(path.indexOf("navi.html") == -1){
//			document.objControl = new NiceShot();
//			document.objControl.onPageShow();	
//		}
//	});